package service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import dao.GoodsMapper;

import pojo.Goods;
import service.GoodsService;

@Service
public class GoodsServiceImpl implements GoodsService {
	@Resource
	private GoodsMapper goodsMapper;
	
	public List<Goods> queryGoodsByDistrict(Integer districtId) {
		if(districtId==null){
			return goodsMapper.queryAllGoods();
		}else{
			return goodsMapper.queryGoodsByDistrict(districtId);
		}
		
	}

	public int modifyGoods(Goods goods) {
		try {
			return goodsMapper.modifyGoods(goods);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return 0;
		}
	}

	public Goods queryGoodsById(Integer id) {
		return goodsMapper.queryGoodsById(id);
	}
	
	public List<Goods> queryAllGoods() {
		
		return goodsMapper.queryAllGoods();
	}

}
